home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10356 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: debug before main()
  5. Date: 7 Mar 96 12:26:02 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.826201562@rscernix>
  8. References: <Pine.SOL.3.91.960305171701.17346B-100000@hamlet.uncg.edu>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <Pine.SOL.3.91.960305171701.17346B-100000@hamlet.uncg.edu> "QIAN . ZHONG" <q_zhong@hamlet.uncg.edu> writes:
  13.  
  14. > What is the good way to debug the program before main(), I am using Borland
  15. >compiler, which generate a map file, and show the program entry point is 
  16. >0000:0000, relative memory start point,
  17. >how to load the program and start debug from 0000:0000 ?
  18.  
  19. Everything that happens before main() is called (in a C program, at least)
  20. is completely beyond your control and you have no business debugging that
  21. code.  It is the startup code, for which no debugging information is
  22. normally available and all you can do is debug at assembly level.  But
  23. since you can't change that code (unless you happen to have its source)
  24. what's the point in "debugging" it?
  25.  
  26. In a C++ program constructors for global objects may be called before main().
  27. In such a case, set breakpoints at the beginning of the appropriate
  28. constructors, if you want to debug them.
  29.  
  30. Dan
  31. --
  32. Dan Pop
  33. CERN, CN Division
  34. Email: danpop@mail.cern.ch 
  35. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  36.